package com.ruoyi.handing.controller;

import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.handing.domain.AlgsReviewRecord;
import com.ruoyi.handing.service.IAlgsReviewRecordService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 已通过审核记录Controller
 * 
 * @author ruoyi
 * @date 2023-03-20
 */
@RestController
@RequestMapping("/reviewRecord")
public class AlgsReviewRecordController extends BaseController
{
    @Autowired
    private IAlgsReviewRecordService algsReviewRecordService;

    /**
     * 查询已通过审核记录列表
     */
//    @RequiresPermissions("reviewRecord:reviewRecord:list")
    @GetMapping("/list")
    public TableDataInfo list(AlgsReviewRecord algsReviewRecord)
    {
        startPage();
        List<AlgsReviewRecord> list = algsReviewRecordService.selectAlgsReviewRecordList(algsReviewRecord);
        return getDataTable(list);
    }

    /**
     * 导出已通过审核记录列表
     */
//    @RequiresPermissions("reviewRecord:reviewRecord:export")
    @Log(title = "已通过审核记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, AlgsReviewRecord algsReviewRecord)
    {
        List<AlgsReviewRecord> list = algsReviewRecordService.selectAlgsReviewRecordList(algsReviewRecord);
        ExcelUtil<AlgsReviewRecord> util = new ExcelUtil<AlgsReviewRecord>(AlgsReviewRecord.class);
        util.exportExcel(response, list, "已通过审核记录数据");
    }

    /**
     * 获取已通过审核记录详细信息
     */
//    @RequiresPermissions("reviewRecord:reviewRecord:query")
    @GetMapping(value = "/{algsReviewId}")
    public AjaxResult getInfo(@PathVariable("algsReviewId") Long algsReviewId)
    {
        return success(algsReviewRecordService.selectAlgsReviewRecordByAlgsReviewId(algsReviewId));
    }

    /**
     * 新增已通过审核记录
     */
//    @RequiresPermissions("reviewRecord:reviewRecord:add")
    @Log(title = "已通过审核记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody AlgsReviewRecord algsReviewRecord)
    {
        return toAjax(algsReviewRecordService.insertAlgsReviewRecord(algsReviewRecord));
    }

    /**
     * 修改已通过审核记录
     */
//    @RequiresPermissions("reviewRecord:reviewRecord:edit")
    @Log(title = "已通过审核记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody AlgsReviewRecord algsReviewRecord)
    {
        return toAjax(algsReviewRecordService.updateAlgsReviewRecord(algsReviewRecord));
    }

    /**
     * 删除已通过审核记录
     */
//    @RequiresPermissions("reviewRecord:reviewRecord:remove")
    @Log(title = "已通过审核记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{algsReviewIds}")
    public AjaxResult remove(@PathVariable Long[] algsReviewIds)
    {
        return toAjax(algsReviewRecordService.deleteAlgsReviewRecordByAlgsReviewIds(algsReviewIds));
    }
}
